home *** CD-ROM | disk | FTP | other *** search
- /*
- ********************************************************************************
- **
- ** File: DrawSprocket.h
- **
- ** Author(s): Dan Venolia (DV)
- ** Cary Farrier (CF)
- **
- ** Contents: DrawSprocket interface file.
- **
- ** Copyright (c) 1995-96 Apple Computer, Inc.
- **
- ********************************************************************************
- */
-
- #ifndef __DrawSprocket_h__
- #define __DrawSprocket_h__
-
- #include <Types.h>
- #include <Events.h>
- #include <Quickdraw.h>
- #include <QDOffscreen.h>
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- /*
- ********************************************************************************
- ** error codes
- ********************************************************************************
- */
- enum {
- kDSInvalidDisplayObjectErr = -4600L,
- kDSGDeviceBusyErr,
- kDSGDeviceNotFoundErr,
- kDSInvalidParameterErr,
- kDSNotEnoughMemoryErr,
- kDSGammaTableDataTooWideErr,
- kDSDisplayManagerTooOldErr,
- kDSInvalidBackBufferErr,
- kDSNotEnoughPagesErr,
- kDSFeatureNotInHWErr
- };
-
- /*
- ********************************************************************************
- ** constants
- ********************************************************************************
- */
-
- enum {
- kSmoothFadeOut = -1L,
- kSmoothFadeIn = -2L
- };
-
- enum {
- kDisplayDepthMask1 = 1U<<0,
- kDisplayDepthMask2 = 1U<<1,
- kDisplayDepthMask4 = 1U<<2,
- kDisplayDepthMask8 = 1U<<3,
- kDisplayDepthMask16 = 1U<<4,
- kDisplayDepthMask32 = 1U<<5,
- kDisplayDepthMaskAll = ~0U
- };
-
- /*
- ** use this in colorNeeds to specify if you must have color
- ** (kDisplayColorRequire), you prefer color (kDisplayColorRequest) but
- ** can live without it (you may get B&W or grayscales), or you just don't
- ** care (kDisplayColorDontCare) and can work with any type of display
- ** because you are a god.
- */
- enum {
- kDisplayColorDontCare = 0L,
- kDisplayColorRequest = 1L,
- kDisplayColorRequire = 2L
- };
-
- enum {
- kDisplayPlayStateActive = 0L,
- kDisplayPlayStatePaused = 1L,
- kDisplayPlayStateInactive = 2L
- };
-
- enum {
- kDisplaySpecialQD3DAccel = 1U<<0,
- kDisplaySpecialDoubleBuffer = 1U<<1,
- kDisplaySpecialPageFlip = 1U<<2
- };
-
- /*
- ** kDisplaySpecialBuffered is a handy way to specify that you want
- ** some form of double buffering in specialFlags, but don't put it in the
- ** specialFlagsInHW field or it will almost never match
- ** (kDisplaySpecialDoubleBuffer in HW is rare).
- */
- #define kDisplaySpecialBuffered \
- ( kDisplaySpecialDoubleBuffer | kDisplaySpecialPageFlip )
-
- /*
- ********************************************************************************
- ** data types
- ********************************************************************************
- */
- typedef void *DisplayObject;
-
- /* a DSBusyProcPtr must return true if the display object is busy */
- typedef Boolean (*DSBusyProcPtr)(DisplayObject inDisplayObject,
- UInt32 inUserRefCon );
-
- /*
- ** a DSUserEventProcPtr is used to process events when the user display
- ** selection dialog is active
- */
- typedef pascal Boolean (*DSUserEventProcPtr)( EventRecord *inEvent );
-
- struct DisplayConfig {
- /*
- ** these describe the device & mode being used
- */
- GDHandle device;
- UInt32 mode;
- UInt32 frequency;
-
- /*
- ** these are the dimensions that you would like to render into
- */
- UInt32 width;
- UInt32 height;
-
- /*
- ** set colorNeeds to tell DS if you need color, or if
- ** a b/w or grayscale display is OK
- */
- UInt32 colorNeeds;
-
- /*
- ** this is the initial color table you want to start with,
- ** only useful for indexed modes
- */
- CTabHandle colorTable;
-
- /*
- ** specialFlags indicates your requirements in general (emulation
- ** of the capablity by DS is OK), and specialFlagsInHW indicates
- ** the DS capabilites which you require NOT to be emulated
- */
- UInt32 specialFlags;
- UInt32 specialFlagsInHW;
-
- /*
- ** these are the depths that are acceptable to the game, set
- ** as many as are acceptable
- */
- UInt32 backBufferDepthMask;
- UInt32 frontBufferDepthMask;
-
- /*
- ** best depth will tell DS what possible depth in the
- ** depth mask is the best one to use when it has a choice
- */
- UInt8 backBufferBestDepth;
- UInt8 frontBufferBestDepth;
-
- /*
- ** when pageCount is an output, it indicates the number of
- ** video pages available. A value of 1 means that the pages
- ** would be implemented in software, and will be limited by
- ** the amount of memory in the system.
- **
- ** when pageCount is an input, it indicates the number of
- ** video pages to be used by the game. Currently DS will ignore
- ** pageCount in this context and only allow double buffering, but
- ** this will be used when we add support for N buffering. For now
- ** it will return kDSNotEnoughPagesErr if this value is anything
- ** other than 2 on input.
- */
- UInt8 pageCount;
-
- /*
- ** if you set these to anything other than 0 you will look very very silly
- ** in future versions of DS, people will laugh at you, and you will have
- ** to move into a cardboard box
- */
- UInt8 reserved1;
- UInt32 reserved2;
-
- };
- typedef struct DisplayConfig DisplayConfig;
-
- /*
- ********************************************************************************
- ** debug prototypes, operational only in the debugging version of DS
- ********************************************************************************
- */
-
- /*
- ** set this to TRUE to bypass gamma fading & the blanking window, they
- ** can make it hard to debug :-)
- */
- void DSpSetDebugMode( Boolean inDebugFlag );
-
- /*
- ********************************************************************************
- ** prototypes
- ********************************************************************************
- */
- OSStatus DisposeDisplay( DisplayObject inDisplayObject );
-
- OSStatus FadeDisplayGamma( DisplayObject inDisplayObject,
- SInt32 inPercentOfOriginalIntensity, /* 50 = 50%, 150 = 150%, etc */
- RGBColor *inZeroIntensityColor );
-
- OSStatus FindGDeviceFromConfig( DisplayConfig *ioConfig );
-
- OSStatus GetDisplayActualConfig( const DisplayObject inDisplayObject,
- DisplayConfig *outActualConfig );
-
- OSStatus GetDisplayBackBuffer( const DisplayObject inDisplayObject,
- GWorldPtr *outGWorld );
-
- OSStatus GetDisplayConfig( const DisplayObject inDisplayObject,
- DisplayConfig *outConfig );
-
- UInt32 GetDisplayFrameCount( const DisplayObject inDisplayObject );
-
- UInt32 GetDisplayFrameSkip( const DisplayObject inDisplayObject );
-
- OSStatus GetDisplayFrontBuffer( const DisplayObject inDisplayObject,
- GWorldPtr *outGWorld );
-
- GDHandle GetDisplayGDevice( const DisplayObject inDisplayObject );
-
- OSStatus GetDisplayPlayState( const DisplayObject inDisplayObject,
- UInt32 *outPlayState );
-
- OSStatus GetModeCapabilities( DisplayConfig *ioConfig );
-
- OSStatus GetModeCount( const GDHandle inGDevice, UInt32 *outModeCount );
-
- Boolean IsDisplayBusy( const DisplayObject inDisplayObject );
-
- OSStatus NewDisplay( const DisplayConfig *inConfig,
- DisplayObject *outDisplayObject );
-
- OSStatus RestoreSavedGDevice( const GDHandle inGDevice, GDHandle *outGDevice );
-
- void SetBlankingColor( const RGBColor *inRGBColor );
-
- void SetDisplayFrameSkip( DisplayObject inDisplayObject,
- UInt32 inFrameSkip );
-
- OSStatus SetDisplayPlayState( DisplayObject inDisplayObject,
- UInt32 inPlayState );
-
- OSStatus SwapDisplayBuffers( DisplayObject inDisplayObject,
- DSBusyProcPtr inUserBusyProc, UInt32 inUserRefCon );
-
- #if 0
- /*
- ********************************************************************************
- ** calls beyond this point are not implemented yet
- ********************************************************************************
- */
-
- OSStatus UserSelectGDevice(
- DisplayConfig *ioConfig,
- DSUserEventProcPtr inUserEventProc,
- Str255 inUserPrompt );
-
- OSStatus InvalDisplayRect(
- const DisplayObject inDisplayObject,
- const Rect *inRect ); /* rect describes a pixel area, not a logical area */
-
- OSStatus SetMaxInvalidRects(
- const DisplayObject inDisplayObject,
- UInt32 inMaxInvalidRects );
-
- OSStatus SetDisplayCLUTEntries(
- const DisplayObject inDisplayObject,
- const ColorSpec *inEntries,
- UInt16 inStartingEntry,
- UInt16 inEntryCount );
-
- OSStatus GetDisplayCLUTEntries(
- const DisplayObject inDisplayObject,
- ColorSpec *outEntries,
- UInt16 inStartingEntry,
- UInt16 inEntryCount );
-
- OSStatus SuspendResumeDrawSprocket(
- Boolean inSuspendingFlag );
- #endif /* 0 */
-
- #ifdef __cplusplus
- }
- #endif
-
- #endif /* __DrawSprocket_h__ */
-